var express = require('express');
const reportBusiness = require('./msisdn-write-business/genMetrics_msisdnWriteBusiness.js')
const reportResource = require('./msisdn-write-resouce/genMetrics_msisdnWriteResouce.js')
const reportServerInfo = require('./node-server-info/genMetrics_serverInfo.js')
const reportServerCount = require('./service-count/genMetrics_serverCount.js')
const reportSegmentSet = require('./number-segment-set/genMetrics_numberSegmentSet.js')
const reportMakeMsisdnOrder = require('./make-msisdn-order/genMetrics_makeMsisdnOrder.js')

var PORT = 8888;

var app = express();
app.get('/', function (req, res) {
  res.send('send metrics program...\n');
});

app.get('/sendBusiness', async function(req, res) {
  const result = await reportBusiness.execReport();
  res.send(result)
})

app.get('/sendResource', async function(req, res) {
  const result = await reportResource.execReport();
  res.send(result)
})

app.get('/sendServerInfo', async function(req, res) {
  const result = await reportServerInfo.execReport();
  res.send(result)
})

app.get('/sendServerCount', async function(req, res) {
  const result = await reportServerCount.execReport();
  res.send(result)
})

app.get('/sendSegmentSet', async function(req, res) {
  const result = await reportSegmentSet.execReport();
  res.send(result)
})
app.get('/sendMakeMsisdnOrder', async function(req, res) {
  const result = await reportMakeMsisdnOrder.execReport();
  res.send(result)
})

app.listen(PORT);
console.log('Running on http://localhost:' + PORT);
